<div class="col-sm-12">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>{$model.title}-修改类别</h5>

        </div>
        <div class="ibox-content">
            <form method="post" action="update" class="form-horizontal" enctype="multipart/form-data">
                <!--类别好了-->
                <input type="hidden" name="id" value="{$model.id}">
                <div class="form-group">
                    <label class="col-sm-3 control-label">品牌名称：</label>
                    <div class="col-sm-9">
                        <input required type="text" value="{$model.title}" name="title" class="form-control" placeholder="">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label">封面图：</label>
                    <div class="col-sm-3" >
                        <input type="file" accept="image/jpeg,image/jpg,image/png" name="pic" class="form-control"><span class="help-block m-b-none">类目需要传图片</span>
                    </div>
                    <div class="col-sm-6" id="pic_box">
                        <img class='thumb' width='100px' height="100px" src="{$model.thumb}" style='max-height:200px'  />
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-4 col-sm-offset-2">
                        <button class="btn btn-primary btn-sm"  type="submit">保存内容</button>
                        <div class="btn btn-white btn-sm" onclick="javascript:window.history.go(-1)">取消</div>
                    </div>
                </div>
            </form>
            <div id="js-openModal1" style="position: absolute;z-index: -2;right: -200px;visibility: hidden" data-toggle="modal" data-target="#myModal6">打开回复的model</div>
        </div>
    </div>
</div>



<script>

    $(function() {
        $("input[name='pic']").on("change", function () {

            var objUrl = getObjectURL(this.files[0]); //获取图片的路径，该路径不是图片在本地的路径
            if (objUrl) {
                var tempStr = "<img class='thumb' width='100px' height='100px' style='max-height:200px'  />",
                    $label = $('#pic_box');
                $label.find('img.thumb').remove()
                $label.append(tempStr);
                $label.find('img.thumb').attr('src', objUrl);

            }
        });

    });

    function getObjectURL(file) {
        var url = null ;
        if (window.createObjectURL!=undefined) { // basic
            url = window.createObjectURL(file) ;
        } else if (window.URL!=undefined) { // mozilla(firefox)
            url = window.URL.createObjectURL(file) ;
        } else if (window.webkitURL!=undefined) { // webkit or chrome
            url = window.webkitURL.createObjectURL(file) ;
        }
        return url ;
    }
</script>